package com.java.comprehensive.design.behavioral_model.command_pattern;

import java.util.Map;

/**
 * @Author 窦绍飞
 * @create 2023/2/16
 * 具体命令类
 */
public class OrderCommand implements Command {
	// 持有接受着对象
	private SeniorChef receiver;

	private Order order;

	public OrderCommand(SeniorChef receiver, Order order) {
		this.receiver = receiver;
		this.order = order;
	}

	@Override
	public void execute() {
		System.out.println(order.getDinnerTableCode() + "桌，订单：");
		Map<String, Integer> foodDir = order.getFoodDir();
		foodDir.forEach((k, v) -> {
			receiver.makeFood(k, v);

		});

		System.out.println(order.getDinnerTableCode() + "桌的食品制作完成");
		System.out.println("===============================================");
	}
}
